<!DOCTYPE html>
<html>
<head>
	<!-- 设置浏览器不缓存 -->
    <META HTTP-EQUIV="pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
    <META HTTP-EQUIV="expires" CONTENT="0">
	<!-- Content-Type -->
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<!-- Favicon -->
	<link rel="shortcut icon" href="./images/logo.png">
	<title>企业服务共享中心-借支单</title>
	<!--stylesheets-->
	<link rel="stylesheet" href="./plugins/element/index.css">
	<script src="./plugins/vue/vue.js"></script>
	<script src="./plugins/element/index.js"></script>
	<script src="./plugins/axios/axios.min.js"></script>
	<script src="./plugins/QRCode/qrcode.js"></script>
	<script src="./js/common/public.js?v=0.8.0.3"></script>
	<!-- 自定义样式表 -->
	<link rel="stylesheet" href="./css/base.css?v=0.8.0.3">
</head>
<body>
<div id="app">
<template>
<el-container class="maincontainer">
	<el-container class="submaincontainer">
		<el-card class="box-card" style="position:relative;width:330px" shadow="never" v-show="leftbar_show">
		  <div style="position:absolute;left:0;top:0;right:0;bottom:0;overflow-y:auto;overflow-x:hidden;padding-left: 20px;padding-top: 20px;padding-right: 20px;">
			<el-form :model="queryForm" ref="queryForm" >
					<el-form-item label="关键字" prop="keyword"  maxlength="20" autocomplete="off">
					  <el-input v-model="queryForm.keyword"></el-input>
					</el-form-item>
					<el-form-item label="相关人员" prop="personnel">
						<el-select v-model="queryForm.personnel" multiple placeholder="请选择" filterable>
							<el-option v-for="item in allusers" :key="item.id" :label="item.name" :value="item.id">
							</el-option>
						</el-select>
					</el-form-item>
					<el-form-item label="状态" prop="status">
						<el-select v-model="queryForm.status" multiple placeholder="请选择" filterable>
							<el-option v-for="item in statuses" :key="item" :label="item" :value="item">
							</el-option>
						</el-select>
					</el-form-item>
					<el-form-item label="日期" prop="date" >
						<el-date-picker style="width:235px"
							value-format="yyyy-MM-dd"
							  v-model="queryForm.date"
							  type="daterange"
							  width="100"
							  align="right"
							  unlink-panels
							  range-separator="至"
							  start-placeholder="开始日期"
							  end-placeholder="结束日期"
							  :picker-options="pickerOptions">
						</el-date-picker>
					</el-form-item>
				  <el-form-item>
					<el-button size="small" type="primary" @click.native.prevent="start" style="position:fixed;left:20px;bottom:5px;">查询</el-button>
				  </el-form-item>
			</el-form>
		  </div>
		</el-card>
		<el-card class="box-card" style="width:100%" shadow="never">
		  <div slot="header" class="clearfix">
		  <i v-on:click="showLeftBar()" v-bind:class="[leftbar_show ? 'el-icon-s-fold' : 'el-icon-s-unfold']" style="color:#409EFF;cursor:pointer;"></i>
			<span>借支单列表</span>
			<el-button-group style="float: right;margin-top:0px;">
					<el-tooltip v-for="item in toolbar" class="item" effect="dark" v-bind:content="item.content" placement="top-start">
						  <el-button size="small" v-bind:icon="item.icon" v-bind:type="item.type" @click="toolAction(item.content)">{{item.content}}</el-button>
					</el-tooltip>
			</el-button-group>
		  </div>
		  <div>
			  <el-table
			row-key="id"
			  border
				ref="multipleTable"
				@select='selectionChange'
				:data="pagedata"
				tooltip-effect="dark"
				:height="tableHeight"
				style="width: 100%;"
				@selection-change="handleSelectionChange">
				<el-table-column
				  type="selection"
				  min-width="55">
				</el-table-column>
				<el-table-column
				v-for="column in tablecolums"
				  v-bind:prop="column.prop"
				  v-bind:label="column.label"
				  v-bind:min-width="column.width"
				  show-overflow-tooltip
				  sortable
				>
				</el-table-column>
				<el-table-column label="操作" min-width="50">
				  <template slot-scope="scope">
						<el-link type="primary" v-show="showAudit(scope.$index, scope.row)" @click="audit(scope.$index, scope.row)">审核</el-link>
						<el-link type="primary" v-show="!showAudit(scope.$index, scope.row)" @click="view(scope.$index, scope.row)">查看</el-link>
				  </template>
				</el-table-column>
			  </el-table>
			  <div style="margin-top: 20px">
				<el-pagination
				@current-change="handleCurrentPageChange"
				:current-page="queryForm.pageNo"
				:page-sizes="queryForm.pagesizes"
				  :page-size="queryForm.pagesize"
				  background
				  layout="total,sizes, prev, pager, next"
				  :total="pagetotal">
				</el-pagination>
			  </div>			  
		  </div>
		</el-card>
	</el-container>
</el-container>
<el-dialog :close-on-click-modal="false"  title="借支单信息" :visible.sync="dialogFormVisible" width="700px">
    <el-form :model="borrowForm" :rules="borrowRules" ref="borrowForm" label-width="80px" :disabled='action=="edit" || action=="view"'>
		<el-row :gutter="20">
		  <el-col :span="8">
				<el-form-item label="部门" prop="deptid">
						<el-select v-model="borrowForm.deptid" @change="deptChange">
						  <el-option
							v-for="item in depts"
							:key="item.id"
							:label="item.name"
							:value="item.id">
						  </el-option>
						</el-select>
				</el-form-item>
		  </el-col>
		  <el-col :span="8">
				<el-form-item label="借支人" prop="borrowerid">
					<el-select v-model="borrowForm.borrowerid" placeholder="默认全部" filterable>
						<el-option-group
						  v-for="group in users"
						  :key="group.deptname"
						  :label="group.deptname">
						  <el-option
							v-for="item in group.users"
							:key="item.id"
							:label="item.name"
							:value="item.id">
						  </el-option>
						</el-option-group>
					</el-select>

				</el-form-item>
		  </el-col>
		  <el-col :span="8">
				<el-form-item label="城市" prop="city">
					<el-select v-model="borrowForm.city" filterable>
						<el-option v-for="item in cities" :key="item" :label="item" :value="item">
						</el-option>
					</el-select>
				</el-form-item>
		  </el-col>
		</el-row>
		<el-row :gutter="20">
		  <el-col :span="24">
			  <el-form-item label="借款事由" prop="content"  >
					<el-input v-model="borrowForm.content" type="textarea"></el-input>
			  </el-form-item>
		  </el-col>
		</el-row>
		<el-row :gutter="20">
		  <el-col :span="8">
			  <el-form-item label="借款金额" prop="amount"  >
				  <el-input v-model="borrowForm.amount" maxlength="8"></el-input>
			  </el-form-item>
		  </el-col>
		  <el-col :span="8">
				<el-form-item label="借款方式" prop="loantype">
					<el-select v-model="borrowForm.loantype" filterable>
						<el-option v-for="item in loantypes" :key="item" :label="item" :value="item">
						</el-option>
					</el-select>
				</el-form-item>
		  </el-col>
		  <el-col :span="8">
				<el-form-item label="还款方式" prop="repaytype">
					<el-select v-model="borrowForm.repaytype" filterable>
						<el-option v-for="item in repaytypes" :key="item" :label="item" :value="item">
						</el-option>
					</el-select>
				</el-form-item>
		  </el-col>
		</el-row>
		<el-row :gutter="20">
		  <el-col :span="12">
				<el-form-item label="还款日期" prop="repaydate">
						<el-date-picker
						  v-model="borrowForm.repaydate"
						  type="date"
						  value-format="yyyy-MM-dd"
						  placeholder="选择日期">
						</el-date-picker>
				</el-form-item>
		  </el-col>
		  <el-col :span="12">
				<el-form-item label="主管" prop="masterid">
					<el-select v-model="borrowForm.masterid" filterable>
						<el-option v-for="item in allusers" :key="item.id" :label="item.name" :value="item.id">
						</el-option>
					</el-select>
				</el-form-item>
		  </el-col>
		</el-row>
		<el-row :gutter="20">
		  <el-col :span="8">
				<el-form-item label="审批人" prop="approverid">
					<el-select v-model="borrowForm.approverid" filterable>
						<el-option v-for="item in allusers" :key="item.id" :label="item.name" :value="item.id">
						</el-option>
					</el-select>
				</el-form-item>
		  </el-col>
		  <el-col :span="8">
				<el-form-item label="出纳" prop="cashierid">
					<el-select v-model="borrowForm.cashierid" filterable>
						<el-option v-for="item in allusers" :key="item.id" :label="item.name" :value="item.id">
						</el-option>
					</el-select>
				</el-form-item>
		  </el-col>
		  <el-col :span="8">
				<el-form-item label="会计" prop="bookkeeperid">
					<el-select v-model="borrowForm.bookkeeperid" filterable>
						<el-option v-for="item in allusers" :key="item.id" :label="item.name" :value="item.id">
						</el-option>
					</el-select>
				</el-form-item>
		  </el-col>
		</el-row>
    </el-form>
    <el-form :model="annexForm" :rules="annexRules" ref="annexForm" label-width="80px" v-show='action=="edit" || action=="view"'  :disabled='action=="view"'>
		<el-row :gutter="20">
		  <el-col :span="24">
			<el-form-item label="支付截图" prop="annex">
				<el-upload class="avatar-uploader" ref="upload" multiple :limit="2" :file-list="borrowForm.annex" :action="uploadurl + borrowForm.id"
				 :headers="headers" list-type="text" :on-preview="handledownloadPreview" :on-remove="handleRemove"
				 :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload">
					<i class="el-icon-plus">点击上传</i>
				</el-upload>
			</el-form-item>
		  </el-col>
   </el-form>

  <div slot="footer" class="dialog-footer">
    <el-button @click="dialogFormVisible = false">取 消</el-button>
    <el-button type="danger" @click="showMemoForm" v-show='action=="edit"'>作 废</el-button>
    <el-button type="primary" @click="cofirm" v-show='action=="add" || action=="edit"'>通 过</el-button>
  </div>
</el-dialog>
<el-dialog :visible.sync="imgdialogVisible">
<img width="100%" :src="imgdialogImageUrl" alt="">
</el-dialog>

<el-dialog :close-on-click-modal="false"  title="作废" :visible.sync="dialogMemoFormVisible" width="450px">
	<el-form :model="memoForm" :rules="memoFormRules" ref="memoForm" label-width="150px">
			<el-row :gutter="20">
				<el-col :span="24">
					<el-form-item label="备注（作废理由）" prop="memo">
						<el-input v-model="memoForm.memo" type="textarea"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
	</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogMemoFormVisible = false">取 消</el-button>
<el-button type="primary" @click="del">作 废</el-button>
</div>
</el-dialog>

</template>
</div>
</body>
<script src="./js/borrow.js?v=0.8.0.3"></script>
</html>
